﻿<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<script src="vue.js"></script>
	</head>
	<body>
		<div id="app">
			<my-component></my-component>
		</div>
	
		<script>
			Vue.component('my-component', {
				data: function(){
					return {
						message: 'Vue.js无难事'
					}
				},
				methods: {
					change(){
						this.message = 'VC++深入详解';
						//Vue.nextTick(() => console.log(this.$refs.msg.textContent))
						this.$nextTick(function(){
							console.log(this.$refs.msg.textContent);
						})
					}
				},
	      template: `
	      	<div>
	      		<p ref="msg">{{ message }}</p>
	      		<button v-on:click="change">修改内容</button>
	      	</div>`
  		});
  		
  
			new Vue({
			  el: '#app'
			})
		</script>
	</body>
</html>